import request from '@/util/request'

export function getGoodsDetail(id, query) {
	return request({
	    url: '/indent/v1/goodssearch/' + id +'/',
	    method: 'POST',
      data: query
	})
}

// 参团、开团
export function joinGroupBuy(query) {
	return request({
	    url: '/indent/v1/joingroupbuy/',
	    method: 'POST',
      data: query
	})
}

// 单独购买
export function joinGroupBuyAlone(query) {
	return request({
	    url: '/indent/v1/joingroupbuy/',
	    method: 'POST',
      data: query
	})
}

// 是否有资格参团、开团
export function isJoinGroupBuy(query) {
	return request({
	    url: '/indent/v1/canjoinpt/?get_type='+query.get_type+'&goods_id='+query.goods_id+'&uid='+query.uid+'&pt_code='+query.pt_code,
	    method: 'get',
	})
}

// 商品列表
export function ptGoodsInfo(query) {
	return request({
	    url: '/indent/v1/ptgoodsinfo/',
	    method: 'get',
      parmas: query
	})
}

// 商品详情
export function ptGoodsInfoDetail(id) {
	return request({
	    url: '/indent/v1/ptgoodsinfo/'+id+'/',
	    method: 'POST'
	})
}


// 获取我的拼团信息 列表
export function myPtStart(query, url) {
	if(url){
		return request({
			baseURL: url.split('indent')[0],
			url: '/indent'+url.split('indent')[1],
			method: 'get',
		})
	}else{
		return request({
				url: '/indent/v1/my_pt_start/?uid='+query.uid+'&status='+query.status,
				method: 'GET',
		})
	}

}


// 获取拼团信息 详情
export function ptStartDetail(query) {
	return request({
	    url: '/indent/v1/my_pt_start',
	    method: 'POST',
			params: query
	})
}

// 获取我的拼团信息 详情
export function myPtStartDetail(query) {
	return request({
	    url: '/indent/v1/pt_order_comment/',
	    method: 'get',
			params: query
	})
}

// 拼团订单确认收货
export function ptOrderDefine(query) {
	return request({
	    url: '/indent/v1/pt_order_comment/',
	    method: 'POST',
			data: query,
	})
}

// 拼团评价
export function ptOrderComments(query) {
	return request({
	    url: '/indent/v1/pt_order_comment/',
	    method: 'POST',
			data: query,
	})
}

// 评论列表
export function ptOrderCommentsList(query, url) {
	if(url){
		return request({
			baseURL: url.split('indent')[0],
			url: '/indent'+url.split('indent')[1],
			method: 'GET',
		})
	}else{
		return request({
		    url: '/indent/v1/pt_order_comment/?get_type=comment&goods_id='+query.goods_id,
		    method: 'GET',
		})
	}
}

// 拼团评价增加浏览量与点赞量
export function ptOrderCommentZan(query) {
	return request({
	    url: '/indent/v1/pt_order_comment/',
	    method: 'POST',
			parmas: query,
	})
}

// 支付
export function ptOrderPay(query) {
	return request({
	    url: '/machine/v1/gzhwxpayparams/',
	    method: 'POST',
			data: query,
	})
}
